<template>
  <div>
    <el-timeline v-for="item in flowList" :key="item.id">
      <el-timeline-item :timestamp=item.creationTime placement="top">
        <el-card style="width: 800px">
          <h4 style="font-weight: bold;">{{item.processStreamContent}}</h4>
          <p> 提交于{{item.creationTime}}</p>
        </el-card>
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script>
  import { listFlow } from "@/api/module/shao/shijian/flow";
export default {
  name: "Zhuizong",
  data() {
    return {
      flowList:[],
      // 查询参数
      queryParams: {
        reportEventId: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.queryParams.reportEventId=this.$route.query.id;
    this.getList()
  },
  methods: {
    //用来接收父组件的调用机制然后执行查数据库操作做到实时更新
    parentHandleclick(){
      //查询数据库操作
      this.getList()
    },
    /** 查询事件流程列表 */
    getList() {
      listFlow(this.queryParams).then(response => {
        this.flowList = response.rows;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        reportEventNumber: null,
        basicEventId: null,
        reportEventState: null,
        reportEventType: null,
        reportFirstLevel: null,
        reportSecondLevel: null,
        situationEdescriptionProcess: null,
        situationMeasuresEvent: null,
        situationTakenMeasures: null,
        situationCausesconsequences: null,
        patientInvolved: null,
        patientId: null,
        patientNumber: null,
        patientDiagnosisCategory: null,
        patientRecordOutpatient: null,
        patientName: null,
        patientGender: null,
        patientDateOfBirth: null,
        patientAge: null,
        patientAgeStage: null,
        patientEthnicGroup: null,
        patientWeight: null,
        patientPreDisease: null,
        patientContact: null,
        patientFamilyNumber: null,
        patientAdmissionTime: null,
        patientDepartment: null,
        patientBedNumber: null,
        patientNursingLevel: null,
        patientEducationLevel: null,
        patientDiagnosis: null,
        occurrenceTime: null,
        occurrenceDate: null,
        occurrenceDateType: null,
        occurrenceTimePeriod: null,
        occurrenceLocation: null,
        occurrenceScenePhotos: null,
        partyName: null,
        partyAge: null,
        partyYearsOfExperience: null,
        partyCategory: null,
        partyEducation: null,
        partyPosition: null,
        partyPost: null,
        resultsPossibilityDispute: null,
        resultsEventSeverity: null,
        resultsEventClassification: null,
        resultsSeverityInjury: null,
        reportMethod: null,
        reportDepartmentId: null,
        reportDepartment: null,
        reportStatus: null,
        reportFillerId: null,
        reportFiller: null,
        reportTime: null,
        reportAttachedImages: null,
        reportOtherRemarks: null,
        reviewStatus: null,
        reviewDepartmentId: null,
        reviewDepartment: null,
        reviewPersonId: null,
        reviewPerson: null,
        reviewTime: null,
        reviewAdvice: null,
        reviewEventType: null,
        fallbackStatus: null,
        fallbackReason: null,
        fallbackPersonId: null,
        fallbackPerson: null,
        invalidationStatus: null,
        invalidationReason: null,
        invalidationPersonId: null,
        invalidationPerson: null,
        handlingStatus: null,
        handlingOpinions: null,
        handlingPicture: null,
        handingPersonId: null,
        handingPerson: null,
        analyzeReports: null,
        analyzeReportsId: null,
        supportDepartmentOne: null,
        supportOneOpinions: null,
        supportOnePicture: null,
        supportOnePersonId: null,
        supportOnePerson: null,
        supportDepartmentTwo: null,
        supportTwoOpinions: null,
        supportTwoPicture: null,
        supportTwoPersonId: null,
        supportTwoPerson: null,
        eventDeterminatione: null,
        eventDeterminationeDescription: null,
        eventDeterminationePersonId: null,
        eventDeterminationePerson: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        creationTime: null,
        updateTime: null,
        userId: null,
        deptId: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
     /* this.queryParams.pageNum = 1;*/
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加事件上报信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getReport(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改事件上报信息";
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除事件上报信息编号为"' + ids + '"的数据项？').then(function() {
        return delReport(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('project/report/export', {
        ...this.queryParams
      }, `report_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
